//
//  LeftImageCell.m
//  LvXi_newVersion
//
//  Created by 王敏 on 16/8/10.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "LeftImageCell.h"

#import "SettingTableViewController.h"

#import "LXLoginViewController.h"

#import "AddCouponViewController.h"

#import "LXCommissionViewController.h"


@implementation LeftImageCell

- (void)awakeFromNib {
    [super awakeFromNib];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
    
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.backgroundColor = [UIColor clearColor];
        self.textLabel.font = [UIFont systemFontOfSize:ISBigScreen?14:11];
        self.contentView.width = ScreenWidth*Ratio_leftVC;
        [self.contentView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cellClick:)]];
        
        self.cellHeight = 40;
    }
    return self;
}
-(void)setImage:(id)image name:(NSString*)name{
    self.image = image;
    self.name = name;
    self.imageView.image = [UIImage imageNamed:image];
    self.textLabel.text = name;
}


-(void)cellClick:(UITapGestureRecognizer*)gesture{
    if([self.name isEqualToString:@"设置"]){
        SettingTableViewController * vc = [[SettingTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
        [[self getCurrentVC].navigationController pushViewController:vc animated:YES];
        
    }
    else if([self.name isEqualToString:@"首页"]){
        if(self.callBack){
            self.callBack(self);
        }
    }
    else if ([self.name isEqualToString:@"添加优惠码"]){
        AddCouponViewController * addVC = [[AddCouponViewController alloc] init];
       [[self getCurrentVC].navigationController pushViewController:addVC animated:YES];
    }
    else if ([self.name isEqualToString:@"分佣"]){
        LXCommissionViewController * commissionVC = [[LXCommissionViewController alloc] init];
        [[self getCurrentVC].navigationController pushViewController:commissionVC animated:YES];

    }
}
@end
